grammar EEvalue;

@header{
package a2;	
}

expression returns[int value]
	: e=multExpr {$value = $e.value;}
	('+' e=multExpr {$value += $e.value;}
	|'-' e=multExpr {$value -= $e.value;}
	)*;
multExpr returns[int value]
	: e=atom {$value = $e.value;}
	('*' e=atom {$value *= $e.value;}
	|'/' e=atom {$value /= $e.value;}
	)*;
atom returns[int value]
	: INT {$value = Integer.parseInt($INT.text);}
	| '('expression')' {$value = $expression.value;}
	;
test[int a, int b] returns[int value] locals[int x, int y] @init{$x=1;$y=1;}: ;

INT : [0-9]+ ;
WS : [ \t\r]+ ->skip;